home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / WUNZ20SR.ZIP / WIZUNZIP.H < prev    next >
C/C++ Source or Header  |  1993-06-08  |  11KB  |  275 lines

  1. #include <windows.h>
  2. #include <assert.h>    /* required for all Windows applications */
  3. #include <commdlg.h>
  4. #include <dlgs.h>
  5.  
  6. /* Main include file for  Windows Unzip: unzip.h
  7.  * This include file is copied into all `C' source modules specific to 
  8.  * Windows Info-ZIP Unzip, version 2.0.
  9.  * Author: Robert A. Heath, 157 Chartwell Rd., Columbia, SC 29210
  10.  * I, Robert A. Heath, place this module, wizunzip.h, in the public domain.
  11.  */
  12.  
  13. #define WIZUNZIP_MAX_PATH 128    /* max total file or directory name path    */
  14. #define OPTIONS_BUFFER_LEN 256    /* buffer to hold .INI file options            */
  15.  
  16. /* These two are dependent on zip directory listing format string.
  17.  * They help find the filename in the listbox entry.
  18.  */
  19. #define SHORT_FORM_FNAME_INX    27
  20. #define LONG_FORM_FNAME_INX 58
  21.  
  22. #define MIN_SHORT_FORMAT_CHARS (SHORT_FORM_FNAME_INX+12)
  23. #define MIN_LONG_FORMAT_CHARS (LONG_FORM_FNAME_INX+12)
  24.  
  25. /* Arbitrary Constants
  26.  */
  27. #define BG_SYS_COLOR COLOR_GRAYTEXT /* background color is a system color */
  28.  
  29. /* Main window menu item positions
  30.  */
  31. #define EDIT_MENUITEM_POS        1    /* edit menu position in main menu */
  32. #define HELP_MENUITEM_POS       5   /* the Help menu                */
  33.  
  34. /* Main Window Message Codes
  35.  */
  36.  
  37. #define IDM_OPEN            101
  38. #define IDM_EXIT            102
  39.  
  40. #define IDM_SHORT           104
  41. #define IDM_LONG            105
  42.  
  43.  
  44. #define IDM_HELP            106
  45. #define IDM_ABOUT           107
  46.  
  47. #define IDM_RECR_DIR_STRUCT 108
  48. #define IDM_OVERWRITE       109
  49. #define IDM_TRANSLATE       110
  50. #define IDM_UNZIP_TO_ZIP_DIR 111
  51.  
  52. #define IDM_EDIT            112
  53. #define IDM_PATH            113
  54.  
  55.  
  56. #define IDM_COMMENT         117
  57. #define IDM_SOUND_OPTIONS   118
  58. #define IDM_COPY            119
  59. #define IDM_SELECT_ALL      120
  60.  
  61. /* These six items are the tab-stop windows whose ID's must be kept
  62.  * in order.
  63.  */
  64. #define IDM_LISTBOX         121
  65. #define IDM_EXTRACT         122
  66. #define IDM_DISPLAY         123
  67. #define IDM_TEST            124
  68. #define IDM_SHOW_COMMENT    125
  69. #define IDM_STATUS          126
  70. #define TABSTOP_ID_BASE IDM_LISTBOX
  71.  
  72.  
  73. #define IDM_AUTOCLEAR_STATUS 129
  74. #define IDM_SELECT_BY_PATTERN 130
  75.  
  76. /* Keep these 3 in order */
  77. #define IDM_SPLIT            131
  78. #define IDM_MAX_LISTBOX        132
  79. #define IDM_MAX_STATUS        133
  80.  
  81. /* Keep these 3 in order */
  82. #define IDM_LB_EXTRACT      135
  83. #define IDM_LB_DISPLAY      136
  84. #define IDM_LB_TEST         137
  85.  
  86. #define IDM_DESELECT_ALL    138
  87. #define IDM_CLEAR_STATUS    139
  88. #define IDM_HELP_KEYBOARD   140
  89. #define IDM_HELP_HELP       141
  90. #define IDM_CHDIR           142
  91. #define IDM_SETFOCUS_ON_STATUS 143 /* internal: posted after extraction to Status window */
  92.  
  93.  
  94. /* Help Window Menu and Message ID's
  95.  */
  96. #define INDEX_MENU_ITEM_POS 0
  97.  
  98. #define IDM_FORWARD 100
  99. #define IDM_BACKWARD 101 
  100.  
  101.  
  102. /* Tab-stop table is used to sub-class those main window items to
  103.  * which the tab and back-tab keys will tab and stop.
  104.  */
  105. typedef struct TabStop_tag {
  106.     FARPROC lpfnOldFunc;        /* original function                */
  107.     HWND hWnd ;         
  108. } TabStopEntry;
  109.  
  110. typedef TabStopEntry *PTABSTOPENTRY;
  111. #define TABSTOP_TABLE_ENTRIES 6
  112.  
  113.  
  114. #ifndef NDEBUG
  115. #define WinAssert(exp) \
  116.         {\
  117.         if (!(exp))\
  118.             {\
  119.             char szBuffer[40];\
  120.             sprintf(szBuffer, "File %s, Line %d",\
  121.                     __FILE__, __LINE__) ;\
  122.             if (IDABORT == MessageBox((HWND)NULL, szBuffer,\
  123.                 "Assertion Error",\
  124.                 MB_ABORTRETRYIGNORE|MB_ICONSTOP))\
  125.                     FatalExit(-1);\
  126.             }\
  127.         }
  128.  
  129. #else
  130.  
  131. #define WinAssert(exp)
  132.  
  133. #endif
  134.  
  135.  
  136. /* Unzip Flags */
  137. typedef struct
  138. {
  139.     unsigned int    fRecreateDirs : 1;
  140.     unsigned int    fTranslate : 1;
  141.     unsigned int    fFormatLong : 1;
  142.     unsigned int    fOverwrite : 1;
  143.     unsigned int    fUnzipToZipDir : 1;
  144.     unsigned int    fBeepOnFinish : 1;
  145.     unsigned int    fDoAll : 1;
  146.     unsigned int    fIconSwitched : 1;
  147.     unsigned int    fHelp : 1;
  148.     unsigned int    fCanDragDrop : 1;
  149.     unsigned int    fAutoClearStatus : 1;
  150.     unsigned int    fUnused : 5;
  151. } UF, *PUF;
  152.  
  153. /* Unzip Miscellaneous Buffers */
  154. typedef struct
  155. {
  156.     char szFileName[WIZUNZIP_MAX_PATH];     /* fully-qualified archive file name in OEM char set */
  157.     char szDirName[WIZUNZIP_MAX_PATH];        /* directory of archive file in ANSI char set */
  158.     char szUnzipToDirName[WIZUNZIP_MAX_PATH];  /* extraction ("unzip to") directory name in ANSI */
  159.     char szUnzipToDirNameTmp[WIZUNZIP_MAX_PATH]; /* temp extraction ("unzip to") directory name in ANSI */
  160.     char szTotalsLine[80];                  /* text for totals of zip archive */
  161.     char szBuffer[OPTIONS_BUFFER_LEN];      /* option strings from .INI, & gen'l scratch buf */
  162.     char szSoundName[WIZUNZIP_MAX_PATH];    /* wave file name or sound from WIN.INI [sounds] in ANSI */
  163.     OPENFILENAME ofn;
  164.     OPENFILENAME wofn;                        /* wave open file name struct */
  165.     MSG msg;
  166.     OFSTRUCT of;                            /* archive open file struct */
  167.     OFSTRUCT wof;                            /* wave open file struct    */
  168. } UMB, __far *LPUMB;
  169.  
  170. extern TabStopEntry TabStopTable[]; /* tab-stop control table           */
  171.  
  172. extern short dxChar, dyChar;    /* size of char in SYSTEM font in pixels    */
  173.  
  174. extern HANDLE hFixedFont;
  175.  
  176. extern HWND hWndComment;        /* comment window                       */
  177. extern HWND hWndList;       /* listbox handle                       */
  178.  
  179. extern HWND hWndMain;        /* the main window handle.         */
  180.  
  181. extern HWND hExtract;           /* extract button               */
  182. extern HWND hDisplay;           /*display button                */
  183. extern HWND hTest;              /* test button                  */
  184. extern HWND hShowComment;       /* show comment button          */
  185. extern HWND hPatternSelectDlg; /* pattern select modeless dialog    */
  186. extern HANDLE hInst;                       /* current instance                      */
  187. extern HMENU  hMenu;                /* main menu handle         */
  188. extern HANDLE hAccTable;
  189.  
  190. extern HANDLE hHourGlass;             /* handle to hourglass cursor      */
  191. extern HANDLE hSaveCursor;            /* current cursor handle       */
  192. extern HANDLE hHelpCursor;          /* help cursor              */
  193. extern HANDLE hFixedFont;           /* handle to fixed font             */
  194. extern HANDLE hOldFont;         /* handle to old font               */
  195.  
  196. extern int hFile;                 /* file handle             */
  197. extern HWND hWndList;             /* list box handle        */
  198. extern HWND hWndStatus;     /* status   */
  199. extern BOOL bRealTimeMsgUpdate; /* update messages window in real-time */
  200. extern BOOL gfCancelDisplay;    /* cancel ongoing display operation */
  201. extern UF uf;
  202.  
  203. extern WORD wLBSelection;   /* default listbox selection action */
  204. extern WORD wWindowSelection; /* window selection: listbox, status, both    */
  205.  
  206. extern HBRUSH hBrush ;          /* brush for  standard window backgrounds  */
  207.  
  208. extern char __based(__segname("STRINGS_TEXT")) szAppName[];     /* application name             */
  209. extern char __based(__segname("STRINGS_TEXT")) szDefaultUnzipToDir[]; /* default unzip to dir */
  210. extern char __based(__segname("STRINGS_TEXT")) szStatusClass[]; /* status class name                */
  211. extern char __based(__segname("STRINGS_TEXT")) szFormatKey[];       /* Format .INI keyword       */
  212. extern char __based(__segname("STRINGS_TEXT")) szOverwriteKey[];    /* Overwrite .INI keyword        */
  213. extern char __based(__segname("STRINGS_TEXT")) szTranslateKey[];    /* Translate .INI keyword        */
  214. extern char __based(__segname("STRINGS_TEXT")) szLBSelectionKey[];  /* LBSelection keyword in .INI */
  215. extern char __based(__segname("STRINGS_TEXT")) szRecreateDirsKey[]; /* re-create directory structure 
  216.                                     .INI keyword             */
  217. extern char __based(__segname("STRINGS_TEXT")) szUnzipToZipDirKey[];   /* unzip to .ZIP dir .INI keyword */
  218. extern char __based(__segname("STRINGS_TEXT")) szAutoClearStatusKey[];   /* autoclear status .INI keyword */
  219. extern char * LBSelectionTable[];
  220. extern char __based(__segname("STRINGS_TEXT")) szNoMemory[] ;       /* error message